package cn.edu.springboot02.controller;

import cn.edu.springboot02.entity.AliPay;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author Mr.ma
 * @since 2022/11/15 14:56
 **/
@RestController
@RequestMapping("/user")
public class UserController {
    @Resource
    private AliPay aliPay;
    @Value("${student.name}")
    private String name;
    @Value("${server.port}")
    private String port;

    @RequestMapping("student")
    public Map<String,String> studentInfo(){
        Map<String,String> map = new HashMap<>();
        map.put("name","李四");
        map.put("age","18");
        return map;
    }

    @RequestMapping("aliPay")
    public AliPay testAliPay(){
        return aliPay;
    }

    @GetMapping("name")
    public String StudentName(){
        return "服务器端口号为：" + port + "，学生姓名为：" + name;
    }
}
